package com.terra;

import android.os.CountDownTimer;
import com.google.android.maps.GeoPoint;

public class MyTimer extends CountDownTimer {
    
	Boolean bRunning;
	MakeCompassView compass;
	
	public MyTimer(long millisInFuture, long countDownInterval) {
      super(millisInFuture, countDownInterval);
      bRunning = true;
    }

    @Override
	public void onFinish() {
    	if( bRunning )
    		start();
    }
   
    @Override
	public void onTick(long millisUntilFinished) {

	        GeoPoint loc = Globals.myLocationOverlay.getMyLocation();
	        if (/*Globals.bTrackGPS &&*/ loc != null) {
	        	Globals.mapView.getController().animateTo(loc);
	        	Globals.dGPSLat = loc.getLatitudeE6() / 1e6;
	        	Globals.dGPSLon = loc.getLongitudeE6() / 1e6;
	        	Globals.dHeading = Globals.myLocationOverlay.getOrientation();
	        }
	        
    		if( compass!=null ) {
    			compass.DistanceBearing();
    		}
    }
}